package com.zzh.compilation.lexical;

import com.zzh.compilation.model.Token;

import java.util.List;
import java.util.Scanner;

/**
 * @author  zhangzhihao Code King You Konw ?
 * @version 1.0
 * @since   未知时间
 * Main class 测试主启动类
 */
public class Main {
    public static void main(String[] args) {

//        #
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter your code (end with # on a new line):");
        while (scanner.hasNextLine()) {
            String line = scanner.nextLine();
            if ("#".equals(line)) {
                break;
            }
            LexicalAnalyzer.inputBuilder.append(line).append('\n');
        }
        List<Token> tokens = LexicalAnalyzer.analyze();
        for (Token token : tokens) {
            System.out.println("line:" + token.getLineNumber() + "  (" + token.getType() + ", " + token.getValue() + ")");
        }

        //添加了语法分析
//        SyntaxAnalyzer.analyzeSyntax(tokens);
    }
}